package com.mr.web;

import com.mr.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @ClassName ItemController
 * @Description: TODO
 * @Author kun
 * @Date 2020/8/18
 * @Version V1.0
 **/
@Controller//用Controller 可以返回页面
@RequestMapping("item")
public class ItemController {

    @Autowired
    private ItemService itemService;
    /**
     * 跳转商品详情
     * @param id
     * @return
     */
    @GetMapping("{id}.html")
    public String toGoodInfo(ModelMap map, @PathVariable("id") Long id){
        //根据spuid查询数据
        Map<String,Object> mapModel=itemService.getInfoModel(id);
        map.putAll(mapModel);
        return "item";
    }
}
